import './assets/main.css'
import { __federation_method_setRemote } from 'virtual:__federation__'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

const app = createApp(App)

const componentList = [
    {
        name: 'remote-a',
        url: 'http://192.168.10.212:9800/remote-a/assets/remoteEntry.js',
        version: '1.0.0'
    },
    {
        name: 'remote-b',
        url: 'http://192.168.10.212:9800/remote-b/assets/remoteEntry.js',
        version: '1.0.0'
    }
]

componentList.forEach((component) => {
    __federation_method_setRemote(component.name, {
        url: () => Promise.resolve(component.url),
        format: 'esm',
        from: 'vite',
    })
})

app.use(createPinia())
app.use(router)

app.mount('#app')
